from turtle import *
from utils import *
import cv2 as c
getscreen().colormode(255)
class tristone():
    def __init__(self,size=None):
        if size!=None:
            self.size=size
    def typer(self):  #打印机勿调用，除非你有35分钟可以浪费
        img = c.imread("F:\\PyFile\\turtle\\noe.jpg")
        shape1 = img.shape
        height=shape1[0]
        weight=shape1[1]
        for i in range(height):
            pu()
            relative_move(-weight,-1)
            pd()
            for j in range(weight):
                if (img[i,j,2]>240 and img[i,j,1>240 and img[i,j,0]>240]):
                    pu()
                else:
                    pd()    
                pencolor((img[i,j,2],img[i,j,1],img[i,j,0]))
                fd(1)
    def one(self):
        seth(-3)
        color((17, 149, 124),(17, 149, 124))
        begin_fill()
        for i in range(150):
            left(6/150)
            fd(1*self.size)
        left(90)
        fd(12*self.size)
        left(90)
        for i in range(150):
            right(6/150)
            fd(1*self.size)
        left(90)
        fd(12*self.size)
        end_fill()
        seth(90)########seth()
        fd(12*self.size)
        right(87)  
        color((116, 227, 208),(116, 227, 208))
        begin_fill()
        for i in range(150):
            right(6/150)
            fd(1*self.size)
        seth(183)
        for i in range(150):
            right(6/150)
            fd(1*self.size)
        end_fill()
    def two(self):
        seth(-3)
        color((75, 193, 173),(75, 193, 173))
        begin_fill()
        for i in range(90):
            left(6/90)
            fd(1*self.size)
        seth(90)
        fd(22*self.size)
        left(93)
        for i in range(90):
            right(6/90)
            fd(1*self.size)
        seth(-90)
        fd(22*self.size)
        end_fill()
    def three(self):
        seth(-3)
        color((116, 227, 208),(116, 227, 208))
        begin_fill()
        for i in range(90):
            left(6/90)
            fd(1*self.size)
        seth(90)
        circle(17*self.size,90)
        seth(180)
        fd(56*self.size)
        circle(17*self.size,90)
        end_fill()
    def four(self):
        color((17, 149, 124),(17, 149, 124))
        begin_fill()
        seth(0)
        fd(56*self.size)
        left(90)
        fd(10*self.size)
        left(90)
        fd(56*self.size)
        left(90)
        fd(10*self.size)
        end_fill()
        pu()
    def five(self):
        seth(180)
        color((116, 227, 208),(116, 227, 208))
        begin_fill()
        circle(-52*self.size,360)
        end_fill()
    def six(self):
        seth(0)
        color((183, 255, 246),(183, 255, 246))
        begin_fill()
        fd(18*self.size)
        left(90)
        fd(6*self.size)
        circle(9*self.size,180)
        fd(6*self.size)
        seth(0)
        end_fill()
        #-----------
        relative_move(3*self.size,0)
        color((17, 149, 124),(17, 149, 124))
        begin_fill()
        left(90)
        fd(6*self.size)
        circle(-7.5*self.size,180)
        seth(-90)
        fd(6*self.size)
        right(90)
        fd(15*self.size)
        end_fill()
        fd(3*self.size)

    def seven(self):
        seth(0)
        color((17, 149, 124),(17, 149, 124))
        begin_fill()
        fd(3*self.size)
        right(90)
        fd(1*self.size)
        left(90)
        fd(3*self.size)
        right(90)
        fd(1*self.size)
        left(90)
        #---------
        fd(78*self.size)
        #---------
        left(90)
        fd(1*self.size)
        right(90)
        fd(3*self.size)
        left(90)
        fd(1*self.size)
        right(90)
        fd(3*self.size)
        left(180)
        fd(90*self.size)
        end_fill()

        color((137, 254, 234),(137, 254, 234))
        begin_fill()
        seth(90)
        fd(5*self.size)
        right(90)
        fd(90*self.size)
        right(90)
        fd(5*self.size)
        right(90)
        fd(90*self.size)
        end_fill()
        relative_move(0,5*self.size)
        right(180)

        color((114, 229, 211),(114, 229, 211))
        begin_fill()
        for i in range(7):
            fd(2*self.size)
            left(90)
            fd(1*self.size)
            right(90)
        fd(62*self.size)
        for i in range(7):
            right(90)
            fd(1*self.size)
            left(90)
            fd(2*self.size)
        right(180)
        fd(90*self.size)
        end_fill()
    def eight(self):
        seth(90)
        color((134, 255, 234),(134, 255, 234))
        begin_fill()
        fd(15*self.size)
        right(90)
        fd(62*self.size)
        right(90)
        fd(15*self.size)
        right(90)
        fd(62*self.size)
        end_fill()
    def nine(self):
        seth(0)
        color((112, 229, 210),(112, 229, 210))
        begin_fill()
        fd(40*self.size)
        left(90)
        fd(15*self.size)
        left(90)
        fd(40*self.size)
        left(90)
        fd(15*self.size)
        end_fill()
    def ten(self):#两个小洞
        seth(0)
        color((17, 149, 124),(17, 149, 124))
        begin_fill()
        fd(8*self.size)
        left(90)
        fd(8*self.size)
        left(90)
        fd(8*self.size)
        left(90)
        fd(8*self.size)
        end_fill()
    def eleven(self):
        seth(0)
        color((17, 149, 124),(17, 149, 124))
        begin_fill()
        fd(3*self.size)
        right(90)
        fd(1*self.size)
        left(90)
        fd(3*self.size)
        right(90)
        fd(1*self.size)
        left(90)
        #---------
        fd(66*self.size)
        #---------
        left(90)
        fd(1*self.size)
        right(90)
        fd(3*self.size)
        left(90)
        fd(1*self.size)
        right(90)
        fd(3*self.size)
        left(180)
        fd(78*self.size)
        end_fill()
        color((137, 254, 234),(137, 254, 234))
        begin_fill()
        seth(90)
        fd(5*self.size)
        right(90)
        fd(78*self.size)
        right(90)
        fd(5*self.size)
        right(90)
        fd(78*self.size)
        end_fill()
        relative_move(0,5*self.size)
        right(180)
        color((114, 229, 211),(114, 229, 211))
        begin_fill()
        for i in range(7):
            fd(2*self.size)
            left(90)
            fd(1*self.size)
            right(90)
        fd(50*self.size)
        for i in range(7):
            right(90)
            fd(1*self.size)
            left(90)
            fd(2*self.size)
        right(180)
        fd(78*self.size)
        end_fill()
    def twelve(self):
        seth(120)
        color((120, 227, 211),(120, 227, 211))
        begin_fill()
        circle(-12*self.size,120)
        seth(120)
        circle(-10*self.size,90)
        for i in range(15):
            left(4)
            fd(1*self.size)
        fd(5*self.size)
        right(90)
        fd(4*self.size)
        right(90)
        fd(5*self.size)
        for i in range(15):
            left(4)
            fd(1*self.size)        
        circle(-10*self.size,90)
        seth(-10)        
        circle(-12*self.size,120)
        seth(180)
        fd(30*self.size)
        end_fill()

    def run(self,size=None):
        if size!=None:
            self.size=size
        else:
            self.size=1

        pensize(1)      
        self.one()
        relative_move(30*self.size,0)
        self.two()
        relative_move(0,22*self.size)
        self.three()
        relative_move((17+28)*self.size,17*self.size)
        self.five()
        relative_move(-28*self.size,0)
        self.four()
        relative_move(-9*self.size,45*self.size)
        self.six()
        relative_move(56*self.size,0)
        self.six()
        relative_move(-64*self.size,45*self.size)
        self.seven()
        relative_move(14*self.size,7*self.size)
        self.eight()
        relative_move(11*self.size,15*self.size)
        self.nine()
        relative_move(8*self.size,0)
        self.ten()
        relative_move(16*self.size,0)
        self.ten()
        relative_move(-44*self.size,16*self.size)
        self.eleven()
        relative_move(16*self.size,7*self.size)
        self.twelve()